package com.lyc.day1107.demo01;

import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.Period;

/**
 * @author ：Xiaochen
 * @date ：Created in 2022/11/7 20:52
 * @description：
 * @modified By：
 * @version:
 */
public class Test03 {
    public static void main(String[] args) {
        LocalDate date = LocalDate.of(2021, 11, 9);
        LocalDate now = LocalDate.now();

        Period period = Period.between(date, now);
        System.out.println("相差的年"+period.getYears());
        System.out.println("相差的月"+period.getMonths());
        System.out.println("相差的天"+period.getDays());

        LocalTime time = LocalTime.of(8, 12, 12);
        LocalTime now1 = LocalTime.now();
        Duration between = Duration.between(time, now1);
        System.out.println(between.toHours());
        System.out.println(between.toMinutes());
        System.out.println(between.getSeconds());


    }
}